home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / AIncludes / AppleEvents.a < prev    next >
Encoding:
Text File  |  1998-08-17  |  13.9 KB  |  425 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        AppleEvents.a
  3. ;
  4. ;    Contains:    AppleEvent Package Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.2
  8. ;
  9. ;    Copyright:    © 1989-1998 by Apple Computer, Inc., all rights reserved
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__APPLEEVENTS__') = 'UNDEFINED' THEN
  18. __APPLEEVENTS__ SET 1
  19.  
  20.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  21.     include 'MacTypes.a'
  22.     ENDIF
  23.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  24.     include 'MixedMode.a'
  25.     ENDIF
  26.     IF &TYPE('__NOTIFICATION__') = 'UNDEFINED' THEN
  27.     include 'Notification.a'
  28.     ENDIF
  29.     IF &TYPE('__EVENTS__') = 'UNDEFINED' THEN
  30.     include 'Events.a'
  31.     ENDIF
  32. ;    Note:    The functions and types for the building and parsing AppleEvent  
  33. ;            messages has moved to AEDataModel.h
  34. ;
  35.  
  36.     IF &TYPE('__AEDATAMODEL__') = 'UNDEFINED' THEN
  37.     include 'AEDataModel.a'
  38.     ENDIF
  39.  
  40.  
  41.                                                             ; Keywords for Apple event parameters 
  42. keyDirectObject                    EQU        '----'
  43. keyErrorNumber                    EQU        'errn'
  44. keyErrorString                    EQU        'errs'
  45. keyProcessSerialNumber            EQU        'psn '                ; Keywords for special handlers 
  46. keyPreDispatch                    EQU        'phac'                ; preHandler accessor call 
  47. keySelectProc                    EQU        'selh'                ; more selector call 
  48.                                                             ; Keyword for recording 
  49. keyAERecorderCount                EQU        'recr'                ; available only in vers 1.0.1 and greater 
  50.                                                             ; Keyword for version information 
  51. keyAEVersion                    EQU        'vers'                ; available only in vers 1.0.1 and greater 
  52. ;  Event Class 
  53.  
  54. kCoreEventClass                    EQU        'aevt'
  55. ;  Event ID’s 
  56.  
  57. kAEOpenApplication                EQU        'oapp'
  58. kAEOpenDocuments                EQU        'odoc'
  59. kAEPrintDocuments                EQU        'pdoc'
  60. kAEQuitApplication                EQU        'quit'
  61. kAEAnswer                        EQU        'ansr'
  62. kAEApplicationDied                EQU        'obit'
  63. ;  Constants for recording 
  64.  
  65. kAEStartRecording                EQU        'reca'                ; available only in vers 1.0.1 and greater 
  66. kAEStopRecording                EQU        'recc'                ; available only in vers 1.0.1 and greater 
  67. kAENotifyStartRecording            EQU        'rec1'                ; available only in vers 1.0.1 and greater 
  68. kAENotifyStopRecording            EQU        'rec0'                ; available only in vers 1.0.1 and greater 
  69. kAENotifyRecording                EQU        'recr'                ; available only in vers 1.0.1 and greater 
  70.  
  71. ;  parameter to AESend 
  72. ; typedef OptionBits                     AESendOptions
  73.  
  74.  
  75. kAENeverInteract                EQU        $00000010            ; server should not interact with user 
  76. kAECanInteract                    EQU        $00000020            ; server may try to interact with user 
  77. kAEAlwaysInteract                EQU        $00000030            ; server should always interact with user where appropriate 
  78. kAECanSwitchLayer                EQU        $00000040            ; interaction may switch layer 
  79. kAEDontRecord                    EQU        $00001000            ; don't record this event - available only in vers 1.0.1 and greater 
  80. kAEDontExecute                    EQU        $00002000            ; don't send the event for recording - available only in vers 1.0.1 and greater 
  81. kAEProcessNonReplyEvents        EQU        $00008000            ; allow processing of non-reply events while awaiting synchronous AppleEvent reply 
  82. ; typedef SInt32                         AESendMode
  83.  
  84.  
  85. kAENoReply                        EQU        $00000001            ; sender doesn't want a reply to event 
  86. kAEQueueReply                    EQU        $00000002            ; sender wants a reply but won't wait 
  87. kAEWaitReply                    EQU        $00000003            ; sender wants a reply and will wait 
  88. kAEDontReconnect                EQU        $00000080            ; don't reconnect if there is a sessClosedErr from PPCToolbox 
  89. kAEWantReceipt                    EQU        $00000200            ; (nReturnReceipt) sender wants a receipt of message 
  90.  
  91. ;  Constants for timeout durations 
  92.  
  93. kAEDefaultTimeout                EQU        -1                    ; timeout value determined by AEM 
  94. kNoTimeOut                        EQU        -2                    ; wait until reply comes back, however long it takes 
  95.  
  96. ;  priority param of AESend 
  97. ; typedef SInt16                         AESendPriority
  98.  
  99.  
  100. kAENormalPriority                EQU        $00000000            ; post message at the end of the event queue 
  101. kAEHighPriority                    EQU        $00000001            ; post message at the front of the event queue (same as nAttnMsg) 
  102.  
  103. ; typedef SInt8                         AEEventSource
  104.  
  105.  
  106. kAEUnknownSource                EQU        0
  107. kAEDirectCall                    EQU        1
  108. kAESameProcess                    EQU        2
  109. kAELocalProcess                    EQU        3
  110. kAERemoteProcess                EQU        4
  111.  
  112.  
  113.  
  114. ; **************************************************************************
  115. ;  The next couple of calls are basic routines used to create, send,
  116. ;  and process AppleEvents. 
  117. ;*************************************************************************
  118.  
  119. ;
  120. ; pascal OSErr AESend(const AppleEvent *theAppleEvent, AppleEvent *reply, AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks, AEIdleUPP idleProc, AEFilterUPP filterProc)
  121. ;
  122.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  123.         Macro
  124.         _AESend
  125.             move.w              #$0D17,D0
  126.             dc.w                $A816
  127.         EndM
  128.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  129.         IMPORT_CFM_FUNCTION AESend
  130.     ENDIF
  131.  
  132. ;
  133. ; pascal OSErr AEProcessAppleEvent(const EventRecord *theEventRecord)
  134. ;
  135.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  136.         Macro
  137.         _AEProcessAppleEvent
  138.             move.w              #$021B,D0
  139.             dc.w                $A816
  140.         EndM
  141.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  142.         IMPORT_CFM_FUNCTION AEProcessAppleEvent
  143.     ENDIF
  144.  
  145.  
  146. ;  
  147. ; Note: during event processing, an event handler may realize that it is likely
  148. ; to exceed the client's timeout limit. Passing the reply to this
  149. ; routine causes a wait event to be generated that asks the client
  150. ; for more time. 
  151. ;
  152.  
  153. ;
  154. ; pascal OSErr AEResetTimer(const AppleEvent *reply)
  155. ;
  156.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  157.         Macro
  158.         _AEResetTimer
  159.             move.w              #$0219,D0
  160.             dc.w                $A816
  161.         EndM
  162.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  163.         IMPORT_CFM_FUNCTION AEResetTimer
  164.     ENDIF
  165.  
  166.  
  167. ; **************************************************************************
  168. ;  The following three calls are used to allow applications to behave
  169. ;  courteously when a user interaction such as a dialog box is needed. 
  170. ;*************************************************************************
  171.  
  172.  
  173. ; typedef SInt8                         AEInteractAllowed
  174.  
  175.  
  176. kAEInteractWithSelf                EQU        0
  177. kAEInteractWithLocal            EQU        1
  178. kAEInteractWithAll                EQU        2
  179. ;
  180. ; pascal OSErr AEGetInteractionAllowed(AEInteractAllowed *level)
  181. ;
  182.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  183.         Macro
  184.         _AEGetInteractionAllowed
  185.             move.w              #$021D,D0
  186.             dc.w                $A816
  187.         EndM
  188.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  189.         IMPORT_CFM_FUNCTION AEGetInteractionAllowed
  190.     ENDIF
  191.  
  192. ;
  193. ; pascal OSErr AESetInteractionAllowed(AEInteractAllowed level)
  194. ;
  195.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  196.         Macro
  197.         _AESetInteractionAllowed
  198.             move.w              #$011E,D0
  199.             dc.w                $A816
  200.         EndM
  201.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  202.         IMPORT_CFM_FUNCTION AESetInteractionAllowed
  203.     ENDIF
  204.  
  205. ;
  206. ; pascal OSErr AEInteractWithUser(long timeOutInTicks, NMRecPtr nmReqPtr, AEIdleUPP idleProc)
  207. ;
  208.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  209.         Macro
  210.         _AEInteractWithUser
  211.             move.w              #$061C,D0
  212.             dc.w                $A816
  213.         EndM
  214.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  215.         IMPORT_CFM_FUNCTION AEInteractWithUser
  216.     ENDIF
  217.  
  218.  
  219. ; **************************************************************************
  220. ;  These calls are used to set up and modify the event dispatch table.
  221. ;*************************************************************************
  222.  
  223. ;
  224. ; pascal OSErr AEInstallEventHandler(AEEventClass theAEEventClass, AEEventID theAEEventID, AEEventHandlerUPP handler, long handlerRefcon, Boolean isSysHandler)
  225. ;
  226.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  227.         Macro
  228.         _AEInstallEventHandler
  229.             move.w              #$091F,D0
  230.             dc.w                $A816
  231.         EndM
  232.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  233.         IMPORT_CFM_FUNCTION AEInstallEventHandler
  234.     ENDIF
  235.  
  236. ;
  237. ; pascal OSErr AERemoveEventHandler(AEEventClass theAEEventClass, AEEventID theAEEventID, AEEventHandlerUPP handler, Boolean isSysHandler)
  238. ;
  239.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  240.         Macro
  241.         _AERemoveEventHandler
  242.             move.w              #$0720,D0
  243.             dc.w                $A816
  244.         EndM
  245.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  246.         IMPORT_CFM_FUNCTION AERemoveEventHandler
  247.     ENDIF
  248.  
  249. ;
  250. ; pascal OSErr AEGetEventHandler(AEEventClass theAEEventClass, AEEventID theAEEventID, AEEventHandlerUPP *handler, long *handlerRefcon, Boolean isSysHandler)
  251. ;
  252.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  253.         Macro
  254.         _AEGetEventHandler
  255.             move.w              #$0921,D0
  256.             dc.w                $A816
  257.         EndM
  258.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  259.         IMPORT_CFM_FUNCTION AEGetEventHandler
  260.     ENDIF
  261.  
  262.  
  263. ; **************************************************************************
  264. ; The following four calls are available for applications which need more
  265. ; sophisticated control over when and how events are processed. Applications
  266. ; which implement multi-session servers or which implement their own
  267. ; internal event queueing will probably be the major clients of these
  268. ; routines. They can be called from within a handler to prevent the AEM from
  269. ; disposing of the AppleEvent when the handler returns. They can be used to
  270. ; asynchronously process the event (as MacApp does).
  271. ;*************************************************************************
  272.  
  273. ;
  274. ; pascal OSErr AESuspendTheCurrentEvent(const AppleEvent *theAppleEvent)
  275. ;
  276.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  277.         Macro
  278.         _AESuspendTheCurrentEvent
  279.             move.w              #$022B,D0
  280.             dc.w                $A816
  281.         EndM
  282.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  283.         IMPORT_CFM_FUNCTION AESuspendTheCurrentEvent
  284.     ENDIF
  285.  
  286. ;  
  287. ; Note: The following routine tells the AppleEvent manager that processing
  288. ; is either about to resume or has been completed on a previously suspended
  289. ; event. The procPtr passed in as the dispatcher parameter will be called to
  290. ; attempt to redispatch the event. Several constants for the dispatcher
  291. ; parameter allow special behavior. They are:
  292. ;      - kAEUseStandardDispatch means redispatch as if the event was just
  293. ;      received, using the standard AppleEvent dispatch mechanism.
  294. ;      - kAENoDispatch means ignore the parameter.
  295. ;         Use this in the case where the event has been handled and no
  296. ;      redispatch is needed.
  297. ;      - non nil means call the routine which the dispatcher points to.
  298. ;
  299.  
  300. ;  Constants for Refcon in AEResumeTheCurrentEvent with kAEUseStandardDispatch 
  301.  
  302. kAEDoNotIgnoreHandler            EQU        $00000000
  303. kAEIgnoreAppPhacHandler            EQU        $00000001            ; available only in vers 1.0.1 and greater 
  304. kAEIgnoreAppEventHandler        EQU        $00000002            ; available only in vers 1.0.1 and greater 
  305. kAEIgnoreSysPhacHandler            EQU        $00000004            ; available only in vers 1.0.1 and greater 
  306. kAEIgnoreSysEventHandler        EQU        $00000008            ; available only in vers 1.0.1 and greater 
  307. kAEIngoreBuiltInEventHandler    EQU        $00000010            ; available only in vers 1.0.1 and greater 
  308. kAEDontDisposeOnResume            EQU        $80000000            ; available only in vers 1.0.1 and greater 
  309. ;  Constants for AEResumeTheCurrentEvent 
  310.  
  311. kAENoDispatch                    EQU        0                    ; dispatch parameter to AEResumeTheCurrentEvent takes a pointer to a dispatch 
  312. kAEUseStandardDispatch            EQU        $FFFFFFFF            ; table, or one of these two constants 
  313. ;
  314. ; pascal OSErr AEResumeTheCurrentEvent(const AppleEvent *theAppleEvent, const AppleEvent *reply, AEEventHandlerUPP dispatcher, long handlerRefcon)
  315. ;
  316.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  317.         Macro
  318.         _AEResumeTheCurrentEvent
  319.             move.w              #$0818,D0
  320.             dc.w                $A816
  321.         EndM
  322.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  323.         IMPORT_CFM_FUNCTION AEResumeTheCurrentEvent
  324.     ENDIF
  325.  
  326. ;
  327. ; pascal OSErr AEGetTheCurrentEvent(AppleEvent *theAppleEvent)
  328. ;
  329.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  330.         Macro
  331.         _AEGetTheCurrentEvent
  332.             move.w              #$021A,D0
  333.             dc.w                $A816
  334.         EndM
  335.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  336.         IMPORT_CFM_FUNCTION AEGetTheCurrentEvent
  337.     ENDIF
  338.  
  339. ;
  340. ; pascal OSErr AESetTheCurrentEvent(const AppleEvent *theAppleEvent)
  341. ;
  342.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  343.         Macro
  344.         _AESetTheCurrentEvent
  345.             move.w              #$022C,D0
  346.             dc.w                $A816
  347.         EndM
  348.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  349.         IMPORT_CFM_FUNCTION AESetTheCurrentEvent
  350.     ENDIF
  351.  
  352.  
  353. ; **************************************************************************
  354. ;  These calls are used to set up and modify special hooks into the
  355. ;  AppleEvent manager.
  356. ;*************************************************************************
  357.  
  358. ;
  359. ; pascal OSErr AEInstallSpecialHandler(AEKeyword functionClass, UniversalProcPtr handler, Boolean isSysHandler)
  360. ;
  361.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  362.         Macro
  363.         _AEInstallSpecialHandler
  364.             move.w              #$0500,D0
  365.             dc.w                $A816
  366.         EndM
  367.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  368.         IMPORT_CFM_FUNCTION AEInstallSpecialHandler
  369.     ENDIF
  370.  
  371. ;
  372. ; pascal OSErr AERemoveSpecialHandler(AEKeyword functionClass, UniversalProcPtr handler, Boolean isSysHandler)
  373. ;
  374.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  375.         Macro
  376.         _AERemoveSpecialHandler
  377.             move.w              #$0501,D0
  378.             dc.w                $A816
  379.         EndM
  380.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  381.         IMPORT_CFM_FUNCTION AERemoveSpecialHandler
  382.     ENDIF
  383.  
  384. ;
  385. ; pascal OSErr AEGetSpecialHandler(AEKeyword functionClass, UniversalProcPtr *handler, Boolean isSysHandler)
  386. ;
  387.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  388.         Macro
  389.         _AEGetSpecialHandler
  390.             move.w              #$052D,D0
  391.             dc.w                $A816
  392.         EndM
  393.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  394.         IMPORT_CFM_FUNCTION AEGetSpecialHandler
  395.     ENDIF
  396.  
  397.  
  398. ; **************************************************************************
  399. ;  This call was added in version 1.0.1. If called with the keyword
  400. ;  keyAERecorderCount ('recr'), the number of recorders that are
  401. ;  currently active is returned in 'result'
  402. ;  (available only in vers 1.0.1 and greater).
  403. ;*************************************************************************
  404.  
  405. ;
  406. ; pascal OSErr AEManagerInfo(AEKeyword keyWord, long *result)
  407. ;
  408.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  409.         Macro
  410.         _AEManagerInfo
  411.             move.w              #$0441,D0
  412.             dc.w                $A816
  413.         EndM
  414.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  415.         IMPORT_CFM_FUNCTION AEManagerInfo
  416.     ENDIF
  417.  
  418.  
  419.  
  420.  
  421.  
  422.     ENDIF ; __APPLEEVENTS__ 
  423.  
  424.